package san.java.methods_06;

/**
 * this关键字
 *  1. 可以使方法的参数列表与成员属性的含义一致
 *  2. 增加程序的可读性
 *  3. 使用this调用构造函数
 */

public class this_ {
    private int a;
    private int b;

    public this_(int a, int b) {
        this.a = a;
        this.b = b;
    }

    public int getA() {
        return a;
    }

    public void setA(int a) {
        this.a = a;
    }

    public int getB() {
        return b;
    }

    public void setB(int b) {
        this.b = b;
    }

    public this_() {
        this(0,1);  // 调用构造函数
    }
}

class T1 {
    public static void main(String[] args) {
        this_ t1 = new this_(0, 1);
        this_ t2 = new this_();
        System.out.println(t2.getA());
    }
}
